/*************************************************
Author: Aven 
Date: 1/23/2013
Description:
Notes: 
*************************************************/

#ifndef __CDailyTaskMgr_h__
#define __CDailyTaskMgr_h__

#include "CDailyTaskConfig.h"
#include "CUserDailyTask.h"
#include "MsgDailyTask.pb.h"

class CDailyTaskMgr
{
public:
	CDailyTaskMgr()
    {
	}

	virtual ~CDailyTaskMgr() 
    {
	}

    int Init();
    int LoadConfig(const char* szLogPath);

    //int AddConfig(CTaskConfigData& stConfigData);

    int GetTaskConfig(int iTaskID, CDailyTaskConfigData& stTaskConfigData);

    int GetDailyTaskCnfSize();
    CDailyTaskConfigData& GetDailyTaskConfig(int iIndex);

    int GetTaskList(CUserDailyTask& stUserTask, MsgAnsGetDailyTask& stTaskListAns);

    int FindYesterdayTask(CUserDailyTask& stUserTask, CPlayerBaseInfo& stPlayerBaseInfo, unsigned int iTaskId);

    int OpenTBox(CUserDailyTask& stUserTask, int iTBox, MsgAnsOpenTbox& stAns);

    int OpenTBoxOne(CUserDailyTask& stUserTask, int iTBox, MsgAnsOpenTbox& stAns);

    int DiyLuckDoubleAwardBox(CUserDailyTask& stUserTask, int& iFucklyBoxId);

    int TriggerTaskAward(CUserDailyTask& stUserTask, CDailyTaskTboxAwardConfigData& curTaskCfgData, MsgAnsOpenTbox& stAns, bool bDoubleAward=false);

    int TriggerClassTaskAward(CUserDailyTask& stUserTask, CDailyTaskClassAwardConfigData& curTaskCfgData, MsgAnsOpenTbox& stAns);

    int OpenClassTBox(CUserDailyTask& stUserTask, int iTBoxClassTypeId, MsgAnsOpenTbox& stAns);

    int CheckIntimacyUpdate(CUserDailyTask& stUserTask);

    int BuySecretaryStyle(CUserDailyTask& stUserTask, int iSecretaryStyle);

    int TriggerTaskFinish(CUserDailyTask& stUserTask, unsigned int iTaskID, int iCount = 1);

    int ValidTaskId(unsigned int iTaskID);

    int CheckHasCeiling(unsigned int iTaskID);

    int GetSecretaryPayConfig(int _iStyleId, CSecretaryPayConfigData& stData);

    int InitForNewUser(CDailyTaskUserData & stUserTaskData);

    int CheckTaskCeiling(CUserDailyTask& stUserTask, unsigned int &iTaskID, unsigned int & iTaskCeilingCount, bool& bHasCeiling);

    int UpdateClassTypeFinish(CUserDailyTask& stUserTask, unsigned int iTaskID);

    //GM Command
    int GMSetDailyTask(CUserDailyTask& stUserTask, int iNewLiveness);
    
    int GetMaxTBoxIdWIthLiveness(int iNewLiveness);

    void SendTaskInfoToFront(CUserDailyTask& stUserTask);

private:
	CDailyTaskConfig _stTaskConfig;
};


#endif // __CDailyTaskMgr_h__

